home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / appsrcs.zip / APPSETUP.ZIP / APPSAVE.C < prev    next >
C/C++ Source or Header  |  1993-02-08  |  2KB  |  64 lines

  1. #define STRICT
  2. #include <windows.h>
  3. #include <windowsx.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include "appsetup.h"
  8.  
  9. /*-------------------------------------------------------------------------*/
  10. BOOL WINAPI SaveDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  11.     {
  12.     static DLGPROC  lpfnRestartDlgProc;
  13.     OFSTRUCT    of;
  14.  
  15.     switch(message)
  16.     {
  17.     case WM_INITDIALOG:
  18.         if(!bAlreadyShell)
  19.         {
  20.         GetPrivateProfileString("boot","shell","",szBuffer,255,"system.ini");
  21.         WritePrivateProfileString(INI_SHELL, OLDSHELL, szBuffer, INI_FILE);
  22.         if(OpenFile("appbar.exe", &of, OF_EXIST | OF_SEARCH) != -1)
  23.             strcpy(szBuffer, of.szPathName);
  24.         else
  25.             strcpy(szBuffer, "appbar.exe");
  26.         }
  27.         else
  28.         GetPrivateProfileString("shell",OLDSHELL,"program.exe",szBuffer,255,"appbar.ini");
  29.         SetDlgItemText(hDlg, IDSAVE_PATH, szBuffer);
  30.         return TRUE;
  31.  
  32.     case WM_COMMAND:
  33.         switch(wParam)
  34.         {
  35.         case IDSAVE_YES:
  36.             WritePrivateProfileString("boot", "shell", szBuffer, "system.ini");
  37.             lpfnRestartDlgProc = (DLGPROC) MakeProcInstance(RestartDlgProc, hInst);
  38.             DialogBox(hInst, "RestartDlg", hDlg, lpfnRestartDlgProc);
  39.             FreeProcInstance((FARPROC) lpfnRestartDlgProc);
  40.             EndDialog(hDlg, 0);
  41.             return TRUE;
  42.  
  43.         case IDSAVE_NO:
  44.             EndDialog(hDlg, 0);
  45.             return TRUE;
  46.  
  47.         case IDSAVE_BROWSE:
  48.             if(BrowseFile(szBuffer, hDlg, EXEFILES))
  49.             SetDlgItemText(hDlg, IDSAVE_PATH, szBuffer);
  50.             return TRUE;
  51.  
  52.         case IDSAVE_PATH:
  53.             if(HIWORD(lParam) == EN_KILLFOCUS)
  54.             {
  55.             GetDlgItemText(hDlg, IDSAVE_PATH, szBuffer, MAXFILECHARS-1);
  56.             SetDlgItemText(hDlg, IDSAVE_PATH, szBuffer);
  57.             }
  58.             return TRUE;
  59.         }
  60.         break;
  61.     }
  62.     return FALSE;
  63.     }
  64.